#include "stdafx.h"
#include <vector>
#include "block.cpp"

using namespace std;



/*All tetrominoes exist inside a bounding square and rotate about the center of this square unless obstructed. 
Tetrominoes of width 3 (J, L, S, T, Z) are placed in the top two rows of the bounding square and 
(for J, L, and T) with the flat side down. I is placed in the top middle row.
All tetrominoes spawn in 2 usually hidden rows at the top of the playfield. They are placed in the 
center of these rows, rounding to the left.
Once a tetromino lands, it does not lock until the lock delay expires. The lock delay behavior, called
Infinity by the Tetris Company, resets the lock delay whenever the tetromino is moved or rotated. 
Hard drop is generally mapped to up, which has no lock delay.
Wall kicks in SRS are extremely flexible compared to those of earlier games. Some rotations result 
in new positions that do not overlap the former position at all, allowing for highly controversial T-spin triples (see Twist).


http://tetris.wikia.com/wiki/SRS
*/

class Tetrominoe 
{  
private:
    Point p;// holds information on the X, Y, w, h for each Tetraminoe
    int centerX, centerY;
     vector<Block> blocks;//blocks that make up current Tetraminoe
     BoundingSquare square;// we rotate the tetraminoe within this boundary
     TetraminoRotation _currentrotationstate;//current rotation state of the object
     TetraminoType _currenttetraminoetype; // this needs to be set 

 
public:
      Tetrominoe(TetraminoType t, TetraminoRotation s);
      Tetraminoe(TetraminoType t);
      static Tetraminoe(); //static constructor that should aid in creating one dynamically. 

      //Need to have a dynamic selection of the type and the rotation 
      void setShape(TetraminoType s, TetraminoRotation t);
      void selectRandomShape(); // sets it to the default for the tetraminoe type
      void LeftRotate();// call to rotate it leftwards
      void RightRotate(); //call to rotate it rightwards
    
};

public enum TetraminoType
{
      _L,
      _J,
      _S 
};

// the tetraminoe starts in one of these phases and loops around when rotation object is called on
//http://tetris.wikia.com/wiki/SRS
//Rotation corresponds to the column entry in the image at the location above
public enum TetraminoRotation
{
      _FIRST,
      _SECOND,
      _THIRD,
      _FOURTH,
      _FIFTH

}


class BoundingSquare
{
public: 
      Point p;
      int width;
      int height;
};


  